package cn.itcast.hotel.web;

import cn.itcast.hotel.pojo.PageResult;
import cn.itcast.hotel.pojo.RequestParams;
import cn.itcast.hotel.service.IHotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @Author Azer
 * @LOVE,,,
 * @Date 2021/11/4 20:11
 */
@RestController
@RequestMapping("/hotel")
public class HotelController {
    @Autowired
    private IHotelService hotelService;

    //搜索酒店数据
    @PostMapping("list")
    public PageResult search(@RequestBody RequestParams params){

        return hotelService.search(params);

    }
    //聚合查询
    @PostMapping("filters")
    public Map<String, List<String>> filters(@RequestBody RequestParams params){
        return hotelService.filters(params);
    }

    //自动补全
    @GetMapping("suggestion")
    public List<String> suggestion(@RequestParam("key") String key){
        return hotelService.suggestion(key);
    }
}
